简体   繁体   English

Python 导入错误:没有名为“服务器”的模块

[英]Python ImportError: No module named 'server'

I am trying to install stratum module in python 3.5 on Ubuntu.我正在尝试在 Ubuntu 上的 python 3.5 中安装层模块。 But I get the error但我得到了错误

ImportError: No module named 'server'导入错误:没有名为“服务器”的模块

My installation command is我的安装命令是

python3 setup.py install python3 setup.py 安装

Any suggestion how to solve this?任何建议如何解决这个问题?

Okay, another method:好的,另一种方法:

  1. First, make sure that your system packages are up-to-date by running these following apt commands in terminal:首先,通过在终端中运行以下 apt 命令来确保您的系统包是最新的:
    • sudo apt update
    • sudo apt upgrade
  2. Install the pip by using apt command:使用 apt 命令安装 pip:
    • apt-get install python-pip
    • Once the installation is completed you can verify that it was successful by using the following command: pip -V安装完成后,您可以使用以下命令验证它是否成功: pip -V
  3. And after that you can use: pip install <package_name>之后你可以使用: pip install <package_name>

From the documentation , it says Python 2.7 or 2.6 is needed.文档中,它说需要Python 2.7 or 2.6 As you are trying to use python 3.5.当您尝试使用 python 3.5 时。

I would suggest going like this ( 0.2.15 is the latest version), most probably it will work, or at least it will be easier to debug.我建议这样做( 0.2.15是最新版本),很可能它会起作用,或者至少它会更容易调试。

sudo apt-get update 
sudo apt-get upgrade

pip3 download stratum==0.2.15
tar xvzf ./stratum-0.2.15.tar.gz
cd stratum-0.2.15
pip3 install .

The best way to install some package is to use pip install.安装某些软件包的最佳方法是使用 pip install。 So at first u need to PATH python and scripts:所以首先你需要 PATH python 和脚本:

  • Hold Win and press Pause .按住Win并按Pause
  • Click Advanced System Settings.单击高级系统设置。
  • Click Environment Variables.单击环境变量。
  • Append追加

  • C:\\Users(your C:\\用户(你的
    username)\\AppData\\Local\\Programs\\Python\\Python36-32用户名)\\AppData\\Local\\Programs\\Python\\Python36-32

  • C:\\Users(your C:\\用户(你的
    username)\\AppData\\Local\\Programs\\Python\\Python36-32\\Scripts用户名)\\AppData\\Local\\Programs\\Python\\Python36-32\\Scripts

    to the Path variable.到路径变量。

  • Restart Command Prompt.重新启动命令提示符。

After that u can use pip install stratum in cmd之后你可以在cmd使用pip install stratum

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM