问题
I'm using anaconda python 3.5.2 in PyCharm using windows 10.
I'm pretty new to python and a complete noob to PyCharm!
I just want to use SSHtunnel.
I have intalled the package and it shown in the project interpreter page:
However when I try to run the code which I cut and pasted from example 1 here https://github.com/pahaz/sshtunnel:
from sshtunnel import SSHTunnelForwarder
server = SSHTunnelForwarder(
'pahaz.urfuclub.ru',
ssh_username="pahaz",
ssh_password="secret",
remote_bind_address=('127.0.0.1', 8080)
)
server.start()
print(server.local_bind_port) # show assigned local port
# work with `SECRET SERVICE` through `server.local_bind_port`.
server.stop()
I get the following error:
C:\Users\HP\Anaconda3\python.exe C:/Users/HP/PycharmProjects/SSH_Downloader/SSH_Downloader
Traceback (most recent call last):
File "C:/Users/HP/PycharmProjects/SSH_Downloader/SSH_Downloader", line 1, in <module>
from sshtunnel import SSHTunnelForwarder
ImportError: cannot import name 'SSHTunnelForwarder'
Process finished with exit code 1
How can I sort this out?
回答1:
sshtunnel
for python and sshtunnel
Anaconda-python are different modules.
To install sshtunnel
for Anaconda; you need to use the Anaconda repository. use below pip
command; Hope this helps:
pip install -i https://pypi.anaconda.org/pypi/simple sshtunnel
More Description Here
回答2:
I think your name of file is sshtunnel.py
回答3:
Just run the command below:
pip install sshtunnel
回答4:
i face this problem on window 10 and fix it buy this line
easy_install sshtunnel
来源:https://stackoverflow.com/questions/40471364/sshtunnel-not-installed-correctly